package dubbo

import (
	"log"
	"os"

	"github.com/apache/dubbo-go/config"
	_ "github.com/apache/dubbo-go/protocol/dubbo"
	_ "github.com/apache/dubbo-go/registry/protocol"

	_ "github.com/apache/dubbo-go/common/proxy/proxy_factory"
	_ "github.com/apache/dubbo-go/filter/filter_impl"

	_ "github.com/apache/dubbo-go/cluster/cluster_impl"
	_ "github.com/apache/dubbo-go/cluster/loadbalance"
	_ "github.com/apache/dubbo-go/registry/zookeeper"
)

// need to setup environment variable "CONF_PROVIDER_FILE_PATH" to "conf/server.yml" before run
func StartDubboServer() {
	providerPath := os.Getenv("CONF_PROVIDER_FILE_PATH")
	if len(providerPath) == 0 {
		panic("Please Specify CONF_PROVIDER_FILE_PATH in Environment.")
	}

	config.Load()
	log.Println("Start Dubbo Server")
}
